<?php
namespace App\Listener;

use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Event\Annotation\Listener;

use App\Repository\UserIntegralRepository;
use App\Job\ApiIntegralJob;

/**
 * @Listener 
 */
class ApiIntegralListener implements ListenerInterface
{
    public function listen(): array
    {
        return [
            \App\Event\UserIntegral\CreateEvent::class,
            \App\Event\UserIntegral\RebootEvent::class,
        ];
    }
    
    // 远程请求
    public function process($event)
    {
        // 远程Api积分
        (new ApiIntegralJob)->push($event->integral->id);
    }
}